package my.framework.ssm.sample.common.enums;

import org.springframework.data.redis.listener.PatternTopic;
import org.springframework.data.redis.listener.Topic;

import java.util.ArrayList;
import java.util.List;

/**
 * @author NuKi
 * @date 2018/11/24 14:08
 */
public enum NotifyEnum {
    /**
     * 发送通知给所有用户
     */
    ALL("notify_All");

    private String pattenName;

    public String getPattenName() {
        return pattenName;
    }

    NotifyEnum(String pattenName) {
        this.pattenName = pattenName;
    }

    public static List<Topic> getNotifyTopicList() {
        List<Topic> topics = new ArrayList<>(NotifyEnum.values().length);
        for (NotifyEnum notifyEnum : NotifyEnum.values()) {
            topics.add(new PatternTopic(notifyEnum.pattenName));
        }
        return topics;
    }
}

